/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.tbp.controle;

import br.com.tbp.exception.PersistenciaException;
import br.com.tbp.model.domain.Supervisor;
import br.com.tbp.persitence.FabricaDePersistencia;
import br.com.tbp.persitence.dao.SupervisorDao;
import java.util.List;

/**
 *
 * @author Diego Freire
 */
public class ControleSupervisor {

    public void adicionar(Supervisor b) throws PersistenciaException {
        SupervisorDao dao = FabricaDePersistencia.createSupervisorDao();
        dao.adicionar(b);
    }

    public List<Supervisor> pesquisar() throws PersistenciaException {
        SupervisorDao dao = FabricaDePersistencia.createSupervisorDao();
        return dao.pesquisar();
    }

    public void atualizar(Supervisor b) throws PersistenciaException {
        SupervisorDao dao = FabricaDePersistencia.createSupervisorDao();
        dao.atualizar(b);
    }

    public void remover(Supervisor b) throws PersistenciaException {
        SupervisorDao dao = FabricaDePersistencia.createSupervisorDao();
        dao.remover(b);
    }

    public List<Supervisor> pesquisar(String nome) throws PersistenciaException {
        SupervisorDao dao = FabricaDePersistencia.createSupervisorDao();
        return dao.pesquisar(nome);
    }

    public Supervisor pesquisar(long id) throws PersistenciaException {
        SupervisorDao dao = FabricaDePersistencia.createSupervisorDao();
        return dao.pesquisar(id);
    }

    public byte[] getFoto(long id) throws PersistenciaException {
        SupervisorDao dao = FabricaDePersistencia.createSupervisorDao();
        return dao.getFoto(id);
    }

    public List<Supervisor> pesquisar(int limit1, int limit2) throws PersistenciaException {
        SupervisorDao dao = FabricaDePersistencia.createSupervisorDao();
        return dao.pesquisar(limit1, limit2);
    }
}
